#region

using System;
using System.Linq;
using System.Messaging;
using NsbMonitorClientService.QueueManager;
using NUnit.Framework;

#endregion

namespace NsbMonitorClientService.Tests.QueueReader
{
    public class can_move_message_from_queue_to_queue : with_local_test_queue
    {
       // protected CountMessagesInQueue _sut;

        private string messageToMoveId;

        [SetUp]
        public void Before()
        {
            // we well try to move sixth message from queue 1 to queue 2

            foreach (var i in Enumerable.Range(1, 10))
            {
                var message = new Message("message1");
                LocalTestQueue1.Send(message, "label" + i);
                if (i == 6)
                {
                    messageToMoveId = message.Id;
                }
            }
        }

        [Test]
        public void can_move_one_message_to_second_queue()
        {
            
            var message = LocalTestQueue1.ReceiveById(messageToMoveId);

            LocalTestQueue2.Send(message);

            Assert.AreEqual(1, LocalTestQueue2.GetAllMessages().Count());
         
        }
    }
}